/*
 * recmatrix.h
 *
 *  Created on: Jul 15, 2011
 *      Author: lihh
 */

#ifndef RECMATRIX_H_
#define RECMATRIX_H_

#include <stdint.h>

class RecMatrixI{
public:
	RecMatrixI(){}

	virtual ~RecMatrixI(){}

	/// use idx to get the matrix node
	virtual bool getIdx(int idx,int64_t& offset,int& rank) = 0;
};

class RecSparseMatrix : public RecMatrixI{
public:
	RecSparseMatrix();

	virtual ~RecSparseMatrix();

	bool getIdx(int idx,int64_t& offset,int& rank);

	bool init(int n);

	bool put(int idx,int64_t& offset,int& rank);

private:
	struct RecNode{
		int64_t offest;
		int rank;
	};
	RecNode* _nodes;
	int _num;
};

#endif /* RECMATRIX_H_ */
